package com.luotf.ccu.neo4j.controller;

import com.luotf.ccu.neo4j.entity.Dizi;
import com.luotf.ccu.neo4j.repository.DiziRepository;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
public class TestController {

    @Resource
    private DiziRepository diziRepository;

    @RequestMapping(value = "/getDizi", method = RequestMethod.GET)
    @ResponseBody
    public List<Dizi> findAllDizi() {
        Iterable<Dizi> all = diziRepository.findAll();
        List<Dizi> list = new ArrayList<>();
        for (Dizi dizi : all) {
            list.add(dizi);
        }
        return list;
    }
}